<?php
namespace app\attachment\loglic;

use app\common\loglic\Update;

class Upgrade extends Update
{
    //在线升级回调
    public function init()
    {
        return true;
    }
    
    //更新应用状态
    public function status()
    {
        return \daicuo\Apply::updateStatus('attachment', 'enable');
    }
    
    //升级插入字段(1.3.4)
    public function field()
    {
        return model('common/Field','loglic')->install([
            [
                'op_name'     => 'attachment',
                'op_value'    => json_encode([
                    'type'      => 'select',
                    'value'     => 1,
                    'option'    => [0=>'禁用',1=>'跳转真实地址',2=>'发送到浏览器'],
                    'relation'  => 'eq',
                    'title'     => '动态附件打开方式',
                ]),
                'op_module'   => 'admin',
                'op_controll' => 'upload',
                'op_action'   => 'index',
            ]
        ]);
    }
}